#@weiXinLayout("编辑收货人信息")

#define weiXinMain()
#@navBar("编辑收货人信息",contextPath+"/weixin/receiver/receiverList")
#include("receiver-form.html")
#end

#define weiXinJs()
<script>
    $(document).ready(function(){
        $("#cityPicker").cityPicker({
            title: "请选择",
            inputReadOnly:true,
            onChange:function(){
               var codes = $(this).attr("data-codes").split(",");
               var codesName = $(this).val().split(" ");
               $("#province_code").val(codes[0]);
               $("#city_code").val(codes[1]);
               $("#area_code").val(codes[2]);

               $("#province").val(codesName[0]);
               $("#city").val(codesName[1]);
               $("#area").val(codesName[2]);
            }
        });

        $("#submitBtn").click(function(){
            $.confirm({
                "title":"系统提示",
                "text":"确定要进行当前操作么？",
                "onOK":function(){
                    var config ={
                        "url":"#(contextPath)/weixin/receiver/doUpdateReceiver",
                        "data":$("#submitForm").serialize(),
                        "successCallBack":function(resp){
                            if(resp.result){
                                $.alert(resp.data,function(){
                                    window.location.href="#(contextPath)/weixin/mine/receiverList"
                                });
                            }else{
                                $.alert(resp.data);
                            }
                        }
                    };
                    var ajax = new AjaxUtils(config);
                    ajax.executeRequest();
                }
            })
        });
    })
</script>
#end